<?php
/**
 * User: WL
 * Time: 12-10-13 - 上午9:14
 * File: index.inc.php
 * Project For ixdcw.com
 */
/**
 * 2013-4-1 Sameal add order by cityid an group level
 */
defined('IN_IXDCW') or exit('Access Denied');
require DT_CORE.'/'.$module.'/common.inc.php';
require DT_CORE.'/buyhelp/common.inc.php';
$navname ='video';

ViewCheck::catExists() or Prompt::listNotFound();
ViewCheck::groupListPermission() or Prompt::noPermission();
$table       = Table::name(Table::NAME_VIDEO);
$table_data  = Table::name(Table::NAME_VIDEO_DATA);
$do = new VideoModule($moduleid);
$condition = "status=3";
$timeList_order = "rand(),addtime desc";
$hitsList_order = "rand(),hits desc";
$tempList = $db->getAll("
		select *  from {$table} a ,{$table_data} b
		where a.itemid=b.itemid and a.status=3
		order by $timeList_order limit 4
");
foreach($tempList as $k=>$t){
	preg_match('/<embed.*?src=[\'"]?([^"\']+)[\'"]?.*?\/>.*/i',$t['content'],$temp);
	$tempList[$k]['videoUrl'] = $temp[1];
}
$hitsList = $do->getList($condition,$hitsList_order,6);

$maincat = Search::mainCat(MODULE_NAME, $catid);
$catList = array();
foreach($maincat[0] as $k=>$v){
	$catList[$v['catid']] = $do->getList($condition.' and catid='.$v['catid'],$timeList_order,6);
}
$seo_file = 'list';
include DT_INC.'/seo.inc.php';
include template('index', $module);

